#ifndef TCPSERVER_H
#define TCPSERVER_H

#include <QtNetwork>
#include "tcpsocket.h"

class TcpServer : public QTcpServer
{
    Q_OBJECT
public:
    TcpServer();
    ~TcpServer();
    void clearClientAll();
    void sendMessage(QString socketId, QByteArray message);
    void closeSocket(QString socketId);
protected:
    virtual void incomingConnection(qintptr socketId);
public:
    QMap<QString, TcpSocket *> socketArray;
private slots:
    void server_slot_readMessage(QString socketId);
    void server_slot_disconnected(QString socketId);
    void server_slot_bytesWritten(QString socketId, qint64 bytes);
signals:
    void server_signal_incomingConnect(QString socketId);
    void server_signal_readMessage(QString socketId);
    void server_signal_disconnected(QString socketId);
    void server_signal_bytesWritten(QString socketId, qint64 bytes);
};

#endif // TCPSERVER_H
